From 0a7f093361951d8db4bbfb3465d290f021435d1c Mon Sep 17 00:00:00 2001 From: robertlipe Date: Mon, 9 Jun 2014 01:42:47 +0000 Subject: [PATCH] Fix leaks that I introduced earlier today. --- gpsbabel/lowranceusr.cc | 2 +- gpsbabel/osm.cc | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/gpsbabel/lowranceusr.cc b/gpsbabel/lowranceusr.cc index edea6a4bd..4322a6cb1 100644 --- a/gpsbabel/lowranceusr.cc +++ b/gpsbabel/lowranceusr.cc @@ -738,7 +738,7 @@ lowranceusr_waypt_disp(const Waypoint* wpt) * Comments are now used by the iFinder (Expedition C supports them) */ if (wpt->description != wpt->shortname) { - QString comment = xstrdup(wpt->description); + QString comment = wpt->description; text_len = comment.length(); if (text_len > MAXUSRSTRINGSIZE) { text_len = MAXUSRSTRINGSIZE; diff --git a/gpsbabel/osm.cc b/gpsbabel/osm.cc index 403355cc8..9a2a26e4b 100644 --- a/gpsbabel/osm.cc +++ b/gpsbabel/osm.cc @@ -464,10 +464,13 @@ osm_strip_html(const char* str) return strip_html(&utf); // util.cc } -static char* +static QString osm_strip_html(const QString& str) { - return osm_strip_html(CSTR(str)); + char* r = osm_strip_html(CSTR(str)); + QString rv(r); + xfree(r); + return rv; } @@ -521,7 +524,7 @@ static void osm_node_tag(xg_string args, const QXmlStreamAttributes* attrv) { QString key, value; - char* str; + QString str; signed char ikey; if (attrv->hasAttribute("k")) { @@ -549,23 +552,23 @@ osm_node_tag(xg_string args, const QXmlStreamAttributes* attrv) wpt->notes += str; } } else if (key == QLatin1String("gps:hdop")) { - wpt->hdop = atof(str); + wpt->hdop = str.toDouble(); } else if (key == QLatin1String("gps:vdop")) { - wpt->vdop = atof(str); + wpt->vdop = str.toDouble(); } else if (key == QLatin1String("gps:pdop")) { - wpt->pdop = atof(str); + wpt->pdop = str.toDouble(); } else if (key == QLatin1String("gps:sat")) { - wpt->sat = atoi(str); + wpt->sat = str.toDouble(); } else if (key == QLatin1String("gps:fix")) { - if (strcmp(str, "2d") == 0) { + if (str == QLatin1String("2d")) { wpt->fix = fix_2d; - } else if (strcmp(str, "3d") == 0) { + } else if (str == QLatin1String("3d")) { wpt->fix = fix_3d; - } else if (strcmp(str, "dgps") == 0) { + } else if (str == QLatin1String("dgps")) { wpt->fix = fix_dgps; - } else if (strcmp(str, "pps") == 0) { + } else if (str == QLatin1String("pps")) { wpt->fix = fix_pps; - } else if (strcmp(str, "none") == 0) { + } else if (str == QLatin1String("none")) { wpt->fix = fix_none; } } -- 2.30.2